<?php

namespace app\api\controller\v46;

use app\api\controller\v2\Auth;
use app\common\cachemodel\UserCoupon;
use think\response\Json;

class Coupon extends Auth
{
    /**
     * 获取 连线咨询 优惠券列表
     * @return Json
     */
    public function getConsultRtcCouponList()
    {
        $userCouponModel = new UserCoupon();
        $pageDataList = $userCouponModel->getList($this->user['id'], 1, false);
        $list = [];
        foreach ($pageDataList as $datum)
        {
            if ($datum['use_range'] !== 100)
            {
                continue;
            }

            $list[] = $datum;
        }
        $resList = $userCouponModel->dataFormatting($list);

        return show(config('code.success'), '请求成功', $resList);
    }
}